home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 January / macformat-020.iso / Shareware City / Developers / OutOfPhase1.01Source / OutOfPhase Folder / MainWindowStuff.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-01  |  13.7 KB  |  345 lines  |  [TEXT/KAHL]

  1. /* MainWindowStuff.h */
  2.  
  3. #ifndef Included_MainWindowStuff_h
  4. #define Included_MainWindowStuff_h
  5.  
  6. /* MainWindowStuff module depends on */
  7. /* MiscInfo.h */
  8. /* Audit */
  9. /* Debug */
  10. /* Definitions */
  11. /* Memory */
  12. /* Screen */
  13. /* EventLoop */
  14. /* Menus */
  15. /* Files */
  16. /* WindowDispatcher */
  17. /* Array */
  18. /* CodeCenter */
  19. /* TextEdit */
  20. /* SampleList */
  21. /* FunctionList */
  22. /* AlgoSampList */
  23. /* WaveTableList */
  24. /* AlgoWaveTableList */
  25. /* InstrList */
  26. /* TrackList */
  27. /* Alert */
  28. /* StartupOpen */
  29. /* CalculatorWindow */
  30. /* GrowIcon */
  31. /* Main */
  32. /* DisassemblyWindow */
  33. /* PcodeSystem */
  34. /* DataMunging */
  35. /* FixedPoint */
  36. /* SampleConsts */
  37. /* NumberDialog */
  38. /* Numbers */
  39. /* GlobalWindowMenuList */
  40. /* BinaryCodedDecimal */
  41. /* PlayPrefsDialog */
  42. /* ImportWAVSample */
  43. /* ImportRAWSample */
  44. /* ImportAIFFSample */
  45. /* BufferedFileInput */
  46. /* BufferedFileOutput */
  47.  
  48. #include "Screen.h"
  49. #include "EventLoop.h"
  50. #include "Menus.h"
  51. #include "FixedPoint.h"
  52. #include "SampleConsts.h"
  53.  
  54. struct MainWindowRec;
  55. typedef struct MainWindowRec MainWindowRec;
  56.  
  57. /* forward declarations */
  58. struct FileSpec;
  59. struct FileType;
  60. struct CalcWindowRec;
  61. struct DisaWindowRec;
  62. struct WaveTableObjectRec;
  63. struct SampleObjectRec;
  64. struct BufferedInputRec;
  65. struct BufferedOutputRec;
  66. struct SampleListRec;
  67. struct AlgoSampListRec;
  68. struct WaveTableListRec;
  69. struct AlgoWaveTableListRec;
  70. struct InstrListRec;
  71.  
  72. /* this enum is used for remembering what kind of final output we want */
  73. typedef enum
  74.     {
  75.         eOutput8Bits EXECUTE(= -5135),
  76.         eOutput16Bits,
  77.         eOutput24Bits,
  78.         eOutput32Bits
  79.     } OutputNumBitsType;
  80.  
  81. /* errors that can occur when attempting to load or save a file */
  82. typedef enum
  83.     {
  84.         eFileLoadNoError EXECUTE(= -31251),
  85.         eFileLoadBadFormat,
  86.         eFileLoadDiskError,
  87.         eFileLoadOutOfMemory
  88.     } FileLoadingErrors;
  89.  
  90.  
  91. /* initialize internal data structures for documents */
  92. MyBoolean                        InitializeDocuments(void);
  93.  
  94. /* clean up any internal data structures used for documents */
  95. void                                ShutdownDocuments(void);
  96.  
  97.  
  98. /* open a new document window and load the document in.  the function takes */
  99. /* ownership of the file specification. */
  100. void                                OpenDocument(struct FileSpec* TheFile);
  101.  
  102. /* close all open documents, subject to the user's ok */
  103. void                                DoCloseAllQuitPending(void);
  104.  
  105. /* close a document.  If the user cancelled, then return False, otherwise True */
  106. MyBoolean                        CloseDocument(MainWindowRec* Window);
  107.  
  108. /* save the document into the current file.  if it hasn't been saved, then call SaveAs */
  109. /* it returns False if it fails. */
  110. MyBoolean                        SaveDocument(MainWindowRec* Window);
  111.  
  112. /* save the document into a new file (don't disturb the current one).  returns False */
  113. /* if it fails.  this function calls SaveDocument() to do the work. */
  114. MyBoolean                        SaveDocumentAs(MainWindowRec* Window);
  115.  
  116.  
  117. /* return True if the document has been modified & should be saved. */
  118. MyBoolean                        HasDocumentBeenModified(MainWindowRec* Window);
  119.  
  120.  
  121. /* main window event handling functions */
  122. void                                MainWindowDoIdle(MainWindowRec* Window,
  123.                                             MyBoolean CheckCursorFlag, OrdType XLoc, OrdType YLoc,
  124.                                             ModifierFlags Modifiers);
  125. void                                MainWindowBecomeActive(MainWindowRec* Window);
  126. void                                MainWindowBecomeInactive(MainWindowRec* Window);
  127. void                                MainWindowJustResized(MainWindowRec* Window);
  128. void                                MainWindowDoMouseDown(OrdType XLoc, OrdType YLoc,
  129.                                             ModifierFlags Modifiers, MainWindowRec* Window);
  130. void                                MainWindowDoKeyDown(unsigned char KeyCode, ModifierFlags Modifiers,
  131.                                             MainWindowRec* Window);
  132. void                                MainWindowClose(MainWindowRec* Window);
  133. void                                MainWindowUpdator(MainWindowRec* Window);
  134. void                                MainWindowMenuSetup(MainWindowRec* Window);
  135. void                                MainWindowDoMenuCommand(MainWindowRec* Window,
  136.                                             MenuItemType* MenuItem);
  137.  
  138.  
  139. /* get the number of spaces per tab that editors should use */
  140. long                                MainWindowGetTabSize(MainWindowRec* Window);
  141.  
  142.  
  143. /* build any function objects that need to be built.  returns True if all of them */
  144. /* were built without a problem. */
  145. MyBoolean                        MainWindowMakeUpToDateFunctions(MainWindowRec* Window);
  146.  
  147. /* build any algorithmic samples that need to be built.  returns True if all of them */
  148. /* were built without a problem. */
  149. MyBoolean                        MainWindowMakeUpToDateAlgoSamps(MainWindowRec* Window);
  150.  
  151. /* build any algorithmic wave tables that need to be built.  returns True if all of */
  152. /* them were built without a problem. */
  153. MyBoolean                        MainWindowMakeUpToDateAlgoWaveTables(MainWindowRec* Window);
  154.  
  155. /* build any instrument specifications that need to be built.  returns True if all of */
  156. /* them were built without a problem. */
  157. MyBoolean                        MainWindowMakeUpToDateInstrList(MainWindowRec* Window);
  158.  
  159.  
  160. /* build everything.  returns True if everything built correctly */
  161. MyBoolean                        MainWindowMakeEverythingUpToDate(MainWindowRec* Window);
  162.  
  163.  
  164. /* deselect any selection in a scrolling list other than the specified list. */
  165. /* specified list may be NIL for unconditional deselect */
  166. void                                MainWindowDeselectAllOtherStringLists(MainWindowRec* Window,
  167.                                             void* TheDontDeselectStringList);
  168.  
  169.  
  170. /* create a new calculator window.  the main window keeps track of all calculator */
  171. /* objects that it has created */
  172. void                                MainWindowNewCalculator(MainWindowRec* Window);
  173.  
  174. /* when a calculator window closes, it calls this to make sure the main window */
  175. /* object knows that it no longer exists */
  176. void                                MainWindowCalculatorClosingNotify(MainWindowRec* Window,
  177.                                             struct CalcWindowRec* Calc);
  178.  
  179.  
  180. /* notify the main window that a new disassembly window has been created. */
  181. MyBoolean                        MainWindowNewDisassemblyNotify(MainWindowRec* Window,
  182.                                             struct DisaWindowRec* DisassemblyWindow);
  183.  
  184. /* notify the main window that a disassembly window has been destroyed. */
  185. void                                MainWindowDisassemblyClosingNotify(MainWindowRec* Window,
  186.                                             struct DisaWindowRec* DisassemblyWindow);
  187.  
  188.  
  189. /* enable global menu items.  these are menu items that can be chosen regardless */
  190. /* of which editor is open (such as New Object, Save...) */
  191. void                                MainWindowEnableGlobalMenus(MainWindowRec* Window);
  192.  
  193. /* this checks to see if the menu item is a global menu item.  if it is, the */
  194. /* associated action is performed and it returns True.  if not, then it returns */
  195. /* False and the specific editor window must handle the menu item. */
  196. MyBoolean                        MainWindowDoGlobalMenuItem(MainWindowRec* Window,
  197.                                             MenuItemType* MenuItem);
  198.  
  199.  
  200. /* get a copy of the left-channel array from a stereo sample.  an error is returned */
  201. /* indicating the success or failure of this call.  the caller is responsible for */
  202. /* disposing both the returned array (*DataOut) and the name string */
  203. SampleErrors                MainWindowGetSampleLeftCopy(void* Window,
  204.                                             char* NullTerminatedName, largefixedsigned** DataOut);
  205.  
  206. /* get a copy of the right-channel array from a stereo sample.  an error is returned */
  207. /* indicating the success or failure of this call.  the caller is responsible for */
  208. /* disposing both the returned array (*DataOut) and the name string */
  209. SampleErrors                MainWindowGetSampleRightCopy(void* Window,
  210.                                             char* NullTerminatedName, largefixedsigned** DataOut);
  211.  
  212. /* get a copy of the sample array from a mono sample.  an error is returned */
  213. /* indicating the success or failure of this call.  the caller is responsible for */
  214. /* disposing both the returned array (*DataOut) and the name string */
  215. SampleErrors                MainWindowGetSampleMonoCopy(void* Window,
  216.                                             char* NullTerminatedName, largefixedsigned** DataOut);
  217.  
  218. /* get the number of frames per wave period for the specified wave table.  an error */
  219. /* code is returned indicating success or failure.  the caller is responsible for */
  220. /* disposing of the name string. */
  221. SampleErrors                MainWindowGetWaveTableFrameCount(void* Window,
  222.                                             char* NullTerminatedName, long* FrameCountOut);
  223.  
  224. /* get the number of tables in the specified wave table.  an error */
  225. /* code is returned indicating success or failure.  the caller is responsible for */
  226. /* disposing of the name string. */
  227. SampleErrors                MainWindowGetWaveTableTableCount(void* Window,
  228.                                             char* NullTerminatedName, long* TableCountOut);
  229.  
  230. /* get a copy of the sample array from a wave table.  an error is returned */
  231. /* indicating the success or failure of this call.  the caller is responsible for */
  232. /* disposing both the returned array (*DataOut) and the name string */
  233. SampleErrors                MainWindowGetWaveTableArray(void* Window,
  234.                                             char* NullTerminatedName, largefixedsigned** DataOut);
  235.  
  236. /* open a new sample editor initialized with the parameters and install the data */
  237. /* in the array RawData into it.  this array is NOT largefixedsigned, but rather is */
  238. /* signed char or signed short, depending on the setting of NumBits.  the caller */
  239. /* is responsible for disposing of RawData. */
  240. struct SampleObjectRec*    MainWindowCopyRawSampleAndOpen(MainWindowRec* Window,
  241.                                             char* RawData, NumBitsType NumBits, NumChannelsType NumChannels,
  242.                                             long Origin, long LoopStart1, long LoopStart2, long LoopStart3,
  243.                                             long LoopEnd1, long LoopEnd2, long LoopEnd3, long SamplingRate,
  244.                                             double NaturalFrequency);
  245.  
  246. /* open a new wave table editor initialized with the parameters and install the data */
  247. /* in the array RawData into it.  this array is not largefixedsigned, but rather is */
  248. /* signed char or signed short, depending on the setting of NumBits.  the caller */
  249. /* is responsible for disposing of RawData. */
  250. struct WaveTableObjectRec*    MainWindowCopyRawWaveTableAndOpen(MainWindowRec* Window,
  251.                                             char* RawData, NumBitsType NumBits, long NumTables,
  252.                                             long FramesPerTable);
  253.  
  254.  
  255. /* get a copy of the name of the current document file.  the name is a heap-allocated */
  256. /* non-null-terminated block. */
  257. char*                                GetCopyOfDocumentName(MainWindowRec* Window);
  258.  
  259. /* dispatch a name change event.  this tells all editors that the document title */
  260. /* has changed, and the window titles should be updated accordingly. */
  261. void                                MainWindowDispatchNameChange(MainWindowRec* Window);
  262.  
  263.  
  264. /* get various attributes for playing back the song */
  265. MyBoolean                        MainWindowGetStereo(MainWindowRec* Window);
  266. MyBoolean                        MainWindowGetSurround(MainWindowRec* Window);
  267. long                                MainWindowGetSamplingRate(MainWindowRec* Window);
  268. long                                MainWindowGetEnvelopeRate(MainWindowRec* Window);
  269. double                            MainWindowGetBeatsPerMinute(MainWindowRec* Window);
  270. double                            MainWindowGetVolumeScaling(MainWindowRec* Window);
  271. OutputNumBitsType        MainWindowGetOutputNumBits(MainWindowRec* Window);
  272. MyBoolean                        MainWindowGetInterpolationOverTime(MainWindowRec* Window);
  273. MyBoolean                        MainWindowGetInterpolationAcrossWaves(MainWindowRec* Window);
  274. double                            MainWindowGetScanningGap(MainWindowRec* Window);
  275. double                            MainWindowGetBufferDuration(MainWindowRec* Window);
  276. MyBoolean                        MainWindowGetClipWarning(MainWindowRec* Window);
  277. char*                                MainWindowGetPostProcessing(MainWindowRec* Window);
  278. MyBoolean                        MainWindowGetPostProcessingEnable(MainWindowRec* Window);
  279.  
  280.  
  281. /* store new values for song playback attributes */
  282. void                                PutMainWindowStereo(MainWindowRec* Window, MyBoolean NewStereoFlag);
  283. void                                PutMainWindowSurround(MainWindowRec* Window, MyBoolean NewSurround);
  284. void                                PutMainWindowSamplingRate(MainWindowRec* Window,
  285.                                             long NewSamplingRate);
  286. void                                PutMainWindowEnvelopeRate(MainWindowRec* Window,
  287.                                             long NewEnvelopeRate);
  288. void                                PutMainWindowBeatsPerMinute(MainWindowRec* Window,
  289.                                             double NewBeatsPerMinute);
  290. void                                PutMainWindowVolumeScaling(MainWindowRec* Window,
  291.                                             double NewVolumeScaling);
  292. void                                PutMainWindowOutputNumBits(MainWindowRec* Window,
  293.                                             OutputNumBitsType NewOutputNumBits);
  294. void                                PutMainWindowInterpolationOverTime(MainWindowRec* Window,
  295.                                             MyBoolean NewInterpOverTime);
  296. void                                PutMainWindowInterpolationAcrossWaves(MainWindowRec* Window,
  297.                                             MyBoolean NewInterpAcrossWaves);
  298. void                                PutMainWindowScanningGap(MainWindowRec* Window,
  299.                                             double NewScanningGap);
  300. void                                PutMainWindowBufferDuration(MainWindowRec* Window,
  301.                                             double NewBufferDuration);
  302. void                                PutMainWindowClipWarning(MainWindowRec* Window,
  303.                                             MyBoolean NewClipWarning);
  304. void                                PutMainWindowPostProcessing(MainWindowRec* Window,
  305.                                             char* NewPostProcessing);
  306. void                                PutMainWindowPostProcessingEnable(MainWindowRec* Window,
  307.                                             MyBoolean NewPostProcessingEnable);
  308.  
  309.  
  310. /* read the general information subblock from the specified file. */
  311. FileLoadingErrors        MainWindowReadData(MainWindowRec* Window,
  312.                                             struct BufferedInputRec* Input);
  313.  
  314. /* write the general information subblock to the specified file. */
  315. FileLoadingErrors        MainWindowWriteData(MainWindowRec* Window,
  316.                                             struct BufferedOutputRec* Output);
  317.  
  318.  
  319. /* get the sample list object for the specified document.  the actual thing */
  320. /* is returned */
  321. struct SampleListRec*    MainWindowGetSampleList(MainWindowRec* Window);
  322.  
  323. /* get the algorithmic sample list object for the specified document.  the actual */
  324. /* thing is returned. */
  325. struct AlgoSampListRec*    MainWindowGetAlgoSampList(MainWindowRec* Window);
  326.  
  327. /* get the wave table list object for the specified document.  the actual thing */
  328. /* is returned */
  329. struct WaveTableListRec*    MainWindowGetWaveTableList(MainWindowRec* Window);
  330.  
  331. /* get the algorithmic wave table list object for the specified document.  the */
  332. /* actual thing is returned */
  333. struct AlgoWaveTableListRec*    MainWindowGetAlgoWaveTableList(MainWindowRec* Window);
  334.  
  335. /* get the instrument list object for the specified document.  the actual thing */
  336. /* is returned */
  337. struct InstrListRec*    MainWindowGetInstrList(MainWindowRec* Window);
  338.  
  339.  
  340. /* this updates the object deletion undo information */
  341. void                                MainWindowNewDeleteUndoInfo(MainWindowRec* Window,
  342.                                             struct FileSpec* Location, struct FileType* File);
  343.  
  344. #endif
  345.